%%%-------------------------------------------------------------------
%%% File    : rdf_spalg_printer.erl
%%% Author  :  <vjache>
%%% Description : 
%%%
%%% Created :  4 May 2009 by  <vjache>
%%%-------------------------------------------------------------------
-module(rdf_spalg_printer).

-include("../include/rdf_spalg.hrl").

%% API
-export([
		 init/0,
		 begin_visit_patt/2,
		 end_visit_patt/2,
		 visit_node/2,
		 begin_visit_bool/2,
		 end_visit_bool/2,
		 visit_pred_arg/2
		 ]).

%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% Function: 
%% Description:
%%--------------------------------------------------------------------
init() ->
	ok.

begin_visit_patt([Patt|Tail]=_Context,State) ->
	io:format(shift("Begin pattern:~p~n",Tail), [element(1,Patt)]),
	State.

end_visit_patt([Patt|Tail]=_Context,State) ->
	io:format(shift("End pattern:~p~n",Tail), [element(1,Patt)]),
	State.

visit_node([Node|Tail]=_Context,State) ->
	io:format(shift("Node :~p~n",Tail), [Node]),
	State.


begin_visit_bool([BoolExpr|Tail]=_Context,State) ->
	io:format(shift("Begin bool expr:~p~n",Tail), [element(1,BoolExpr)]),
	State.

end_visit_bool([BoolExpr|Tail]=_Context,State) ->
	io:format(shift("End bool expr:~p~n",Tail), [element(1,BoolExpr)]),
	State.
visit_pred_arg([PredArg|Tail]=_Context,State) ->
	io:format(shift("Predicate arg:~p~n",Tail), [PredArg]),
	State.

shift(Ini,List) ->
	lists:foldl(fun(_E,Acc)->
						"\t"++Acc
				end,Ini,List).


%%====================================================================
%% Internal functions
%%====================================================================


